var http = require("http");
var host = "127.0.0.1"
var port = "8080"
var server = http.createServer();

var fs = require("fs")
//注册监听
server.on("request",(request,response)=>{
    //指定浏览器如何解析返回的内容
    response.setHeader("content-type","text/html;charset=utf-8")
    response.write("<h1> hello 武昌理工 </h1>")
    response.end()
    // var rs = fs.createReadStream("./index.html")
    // rs.pipe(response)
})
//启动服务
server.listen(port,host,()=>{
    console.log("server is runing on http://127.0.0.1:8080")
})